﻿using System;
using System.Collections.Generic;
using System.Text;
using Volo.Abp;

namespace Mozhi.Abp.Core.Extensions
{
    public static class StringExtension
    {
        public static decimal ToDecimal(this string value)
        {
            if(value.IsNullOrEmpty())
                return 0;

            decimal result = 0;

            if (!decimal.TryParse(value, out result))
                throw new UserFriendlyException($"字符串转数字失败：{value}", "100000");

            return result;
        }
    }
}
